# -*- coding: cp936 -*-


import pygame
import random
from pygame.locals import *

pygame.init()



width,height = 480,480



font = pygame.font.Font(None, 100)
image = pygame.image.load('car.jpg')
tile_size = 120
black, white = (0, 0, 0), (255, 255, 255)
num_str = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16']
random.shuffle(num_str)





screen = pygame.display.set_mode((width,height))

while True:
    k = 0
    
    screen.fill(200)
    pygame.draw.rect(screen, black, (0, 0, width, height))
    for i in range(0,4):
        for j in range(0,4):
            number = font.render(num_str[k],True,white)
            k += 1
            screen.blit(number,(40+i*120,40+j*120))




    for pos in range(1, width / tile_size):
        offset = pos * tile_size
        pygame.draw.line(screen, white, (offset, 0), (offset, height))

    for pos in range(1, height / tile_size):
        offset = pos * tile_size
        pygame.draw.line(screen, white, (0, offset), (width, offset))
    

    for event in pygame.event.get():


        if event.type == pygame.QUIT:
            pygame.quit()
            exit(0)
        elif event.type == MOUSEBUTTONDOWN and event.button == 1:
            screen.fill(0)
        pygame.display.flip()
